﻿
using MyProject;

namespace Service
{

    public interface IUserInfoService
    {
        public UserInfo Login(string account, string password);
        public UserInfo Find(string Nickname);
    }
    public class UserInfoService: IUserInfoService
    {
        public IFreeSql _fsql;
        public UserInfoService(IFreeSql fsql)
        {
            _fsql = fsql;
        }
        public UserInfo Login(string account, string password)
        {
            var userinfo = _fsql.Select<UserInfo>().Where(a => a.Account == account && a.Password == password).First();
            return userinfo;
        }
        public UserInfo Find(string Nickname)
        {
            var userinfo = _fsql.Select<UserInfo>().Where(a => a.NickName == Nickname).First();
            return userinfo;
        }

    }
}
